package test.study.java.btrace;

import com.sun.btrace.AnyType;
import com.sun.btrace.BTraceUtils;
import com.sun.btrace.annotations.BTrace;
import com.sun.btrace.annotations.Kind;
import com.sun.btrace.annotations.Location;
import com.sun.btrace.annotations.OnMethod;
import com.sun.btrace.annotations.ProbeClassName;
import com.sun.btrace.annotations.ProbeMethodName;

@BTrace
public class BTraceArgSimple {

    @OnMethod(
            clazz="study.java.jvm.controller.memory.heap.HeapController",//拦截的方类
            method="test",//拦截的方法
            location=@Location(Kind.ENTRY)//拦截的实际
    )

    public static void anyRead(@ProbeClassName String pcn,
                               @ProbeMethodName String pmn,
                               AnyType[] args) {//AnyType[] args意思是所有参数，如果方法有两个参数String int，那么这里就可写String arg1,int arg2
        BTraceUtils.printArray(args);
        BTraceUtils.println(pcn);
        BTraceUtils.println(pmn);
        BTraceUtils.println();
    }
}
